package com.baidu.yyb.actiivitys;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.baidu.yyb.MMKV.NoteSp;
import com.baidu.yyb.bean.UserData;
import com.baidu.yyb.prensenter.NotePresenter;
import com.baidu.yyb.view.INoteView;
import com.baidu.yyb.view.InitActivity;
import com.lt.utils.Activity.ActivityManager;
import com.lt.utils.Activity.AndroidConfig;
import com.tencent.mmkv.MMKV;

import org.jetbrains.annotations.Nullable;

/**
 * @author LiuTong
 */
public abstract class BaseActivity extends AppCompatActivity implements INoteView, InitActivity {
    protected NotePresenter notePresenter;
    protected Context mContext;
    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(newBase);
        AndroidConfig.getInstance().init(newBase);

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        ActivityManager.addActivity(this);
        MMKV.initialize(this);
        setActivityLayout();
        initData();
        initView();
        initEvent();
        notePresenter = new NotePresenter(this);

    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }



    @Override
    public void showDialog() {

    }

    @Override
    public void showWrongToast(String reason) {

    }

    @Override
    public void showToast(String toast) {

    }

    @Override
    public void goActivity(Class<? extends  BaseActivity> targetActivity, Bundle bundle,boolean isFinish) {
        Intent in = new Intent(mContext, targetActivity);
        if(bundle != null){
            in.putExtras(bundle);
        }
        startActivity(in);
        if(isFinish){
            finish();
        }
    }

    @Override
    public void showLogin(Bundle bundle) {

    }

    @Override
    public void showRegister() {

    }

    @Override
    public UserData getUserData() {

        return null;
    }

    @Override
    public void showActivityMode() {

    }

    @Override
    public void setActivityLayout() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {

    }

    @Override
    public void initEvent() {

    }
}
